
// setName = 1,      //填写昵称
// reqHost = 2,        //登录          
// game = 3,           //申请主持游戏  成功或者失败  isSuccess ： 1 成功 0 失败
// wirteResult = 4,    //填写谜底
// exitGame = 5,       //退出游戏
// joinRoom = 6,        //加入房间
// sendResult = 7       //发送答案

export const Name_error = [
    '',
    '昵称不合法',
    '昵称已存在',
];

export const Host_error = [
    '',
];

export const Game_error = [
    '',
];

export const WResule_error = [
    '',
];
export const Exit_error = [
    '',
];
export const Join_error = [
    '',
];
export const Send_error = [
    '',
];

export let error_list = [
    ['系统错误', '数据库错误'], Name_error, Host_error, WResule_error, Exit_error, Join_error, Send_error
]

export function getMsgError(err_code: number): string {
    if (err_code < 10000) {
        cc.log("error code  < 10000 " + err_code);
        return "";
    }
    let typ: number = Math.floor(err_code / 10000);
    let ind: number = err_code % 10000;
    cc.log("err_code : " + err_code, typ, ind);

    let str = error_list[typ][ind];
    if (str == null) {
        return "不存在 err_code: " + err_code;
    }
    return str;
}